import React, { Component } from 'react'
import ListItem from '../../ToDoList/ListItem'
import PropTypes from 'prop-types'
import './index.css'
export default class index extends Component {
  static propTypes = {
    todos: PropTypes.array.isRequired,
    changeDone: PropTypes.func.isRequired,
    deleteItem: PropTypes.func.isRequired
  }
  render() {
    const {todos} = this.props
    return (
      <div>
         <ul className="todo-main">
           {
             todos.map(todo => {
              const {id} = todo
              return <ListItem deleteItem={this.props.deleteItem} changeDone={this.props.changeDone} key={id} {...todo}/>
             })
           }
         </ul>
      </div>
    )
  }
}
